package cn.tedu.com.enums;

import java.io.Serializable;

/**
 * <p>
 *
 * </p>
 *
 * @author zhaoyue1
 * @Description
 * @since 2021-05-14
 */
public enum UserBaseRelation  {
    USER_DB1(1,"DB1"),
    USER_DB2(2,"DB2"),
    ;

    private Integer code;

    private String name;

    UserBaseRelation(Integer code,String name){
        this.code=code;
        this.name=name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static UserBaseRelation getEnum(Integer code){
        UserBaseRelation[] values = values();
        if(values.length>0){
            for(UserBaseRelation ubr:values){
                if(code.equals(ubr.getCode())){
                    return  ubr;
                }
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return "UserBaseRelation{" +
                "code=" + code +
                ", name='" + name + '\'' +
                '}';
    }
}
